class Solution:
    def totalMoney(self, n: int) -> int:
        week = n // 7
        last_days = n % 7
        last_days_ = (2*week + last_days + 1)* last_days // 2
        weeks_ = (49+7*week)*week//2
        return weeks_ + last_days_

if __name__ == '__main__':
    s = Solution()
    r = s.totalMoney(4)
    print(r)